from record_audio import record_audio
from send_audio_data import send_audio_data,tcp_send_audio_data
from play_audio import get_synthesized_audio
from config import AUDIO_TYPE
import time
def main():
    chunks = record_audio()
    if AUDIO_TYPE == 'tcp':
        all_data_sent = tcp_send_audio_data(chunks)
    elif AUDIO_TYPE == 'mqtt':
        all_data_sent = send_audio_data(chunks)
        
    while not all_data_sent:
        time.sleep(0.1)
    get_synthesized_audio()

if __name__ == '__main__':
    main()


